<template>
  <view v-if="isLoading" class="loading-page">
    <ed-spinner v-if="animate == 'spinner'" ></ed-spinner>
  </view>
</template>

<script>
  export default {
    name:"loading",
    data() {
      return {
        animate:'spinner',
        isLoading:false,
      };
    },
    beforeMount() {
      uni.$off('showLoading');
      uni.$off('hideLoading');
      
      uni.$on('showLoading',(title)=>{
        this.isLoading = true;
      });
      uni.$on('hideLoading',(title)=>{
        this.isLoading = false;
      });
    }
  }
</script>

<style lang="scss" scoped>
  .loading-page{
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 1000;
  }
</style>